﻿<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<script runat="server">
    protected void Page_Load(object sender, EventArgs e)
    {
        FBillDate.SetValue(DateTime.Now.ToString("yyyy/MM/dd"));
    }
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
    <title>帐号列表</title>
    <script type="text/javascript" src="/Scripts/Commen.js"></script>
    <script type="text/javascript" src="/Scripts/INV_ReceiveOrder/INV_ReceiveOrder_Index.js"></script>
</head>
<body>
    <script type="text/javascript" src="/Scripts/ExtTimeOut.js"></script>
    <script type="text/javascript" src="/Scripts/ExtRequiredFieldPluins.js"></script>
    <ext:ResourceManager ID="ResourceManager1" runat="server" />
    <!--列表数据源-->
    <ext:Store ID="ReceiveOrderListStore" IDMode="Explicit" runat="server" RemoteSort="true"
        SkipIdForNewRecords="false" UseIdConfirmation="false" SerializationMode="Complex">
        <Proxy>
            <ext:HttpProxy Url="/ReceiveOrder/ReceiveOrderListPaging/" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FId" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FId" />
                    <ext:RecordField Name="FNumber" />
                    <ext:RecordField Name="FBillDate" />
                    <ext:RecordField Name="FCreateTime" />
                    <ext:RecordField Name="FCreatorId" />
                    <ext:RecordField Name="FStatus" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="limit" Value="8" Mode="Raw" />
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="dir" Value="DESC" />
            <ext:Parameter Name="sort" Value="FId" />
            <ext:Parameter Name="FNumberParam" Value="#{FNumberTFS}.getValue()" Mode="Raw" />
            <ext:Parameter Name="FBillDateFrom" Value="#{FBillDateFrom}.getValue()" Mode="Raw" />
            <ext:Parameter Name="FBillDateTo" Value="#{FBillDateTo}.getValue()" Mode="Raw" />
            <ext:Parameter Name="FStatusId" Value="#{FStatusCBS}.getValue()" Mode="Raw" />
        </BaseParams>
        <SortInfo Field="FCreateTime" Direction="DESC" />
    </ext:Store>
    <!--编辑数据源-->
    <ext:Store ID="ReceiveOrderEidtStore" runat="server" AutoLoad="false">
        <Proxy>
            <ext:HttpProxy Url="/ReceiveOrder/GetReceiveOrderMsgByFId/" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FId" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FId" />
                    <ext:RecordField Name="FNumber" />
                    <ext:RecordField Name="FBillDate" />
                    <ext:RecordField Name="FCreateTime" />
                    <ext:RecordField Name="FCreatorId" />
                    <ext:RecordField Name="FModifyTime" />
                    <ext:RecordField Name="FModifierId" />
                    <ext:RecordField Name="FApproveTime" />
                    <ext:RecordField Name="FApproverId" />
                    <ext:RecordField Name="FStatus" />
                    <ext:RecordField Name="FRemark" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="FId" Value="#{FIdH}.getValue()" Mode="Raw" />
        </BaseParams>
        <Listeners>
            <BeforeLoad Handler="#{EditFormPanel}.el.mask('正在加载信息...', 'x-mask-loading');" />
            <LoadException Handler="#{EditFormPanel}.el.unmask();" />
            <Load Fn="INV_ReceiveOrder.Mgr.formStoreLoaded" />
        </Listeners>
    </ext:Store>
    <!--编辑明细数据源-->
    <ext:Store ID="EditReceiveOrderDetailStore" runat="server" AutoLoad="false" WarningOnDirty="false">
        <Proxy>
            <ext:HttpProxy Url="/ReceiveOrder/GetReceiveOrderDetailListByFParentId/" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FId" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FId" DefaultValue="" />
                    <ext:RecordField Name="FProductId" />
                    <ext:RecordField Name="FProductNumber" />
                    <ext:RecordField Name="FProductName" />
                    <ext:RecordField Name="FNumber" Type="Int" DefaultValue="0" />
                    <ext:RecordField Name="FPrice" Type="Float" DefaultValue="0" />
                    <ext:RecordField Name="FAmount" Type="Float" DefaultValue="0" />
                    <ext:RecordField Name="FRemark" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter Name="FParentId" Value="#{FIdH}.getValue()" Mode="Raw" />
        </BaseParams>
    </ext:Store>
    <!--状态数据源-->
    <ext:Store ID="OrderStatusStore" runat="server" AutoLoad="true">
        <Proxy>
            <ext:HttpProxy Url="/ReceiveOrder/GetReceiveOrderStatusList/" />
        </Proxy>
        <Reader>
            <ext:JsonReader IDProperty="FID" Root="data" TotalProperty="total">
                <Fields>
                    <ext:RecordField Name="FID" />
                    <ext:RecordField Name="FName" />
                </Fields>
            </ext:JsonReader>
        </Reader>
    </ext:Store>
    <!--当前编辑帐号的FId-->
    <ext:Hidden ID="FIdH" IDMode="Explicit" runat="server" Text="" AutoDataBind="true">
    </ext:Hidden>
    <ext:Viewport ID="AccountViewport" runat="server" Layout="BorderLayout">
        <Items>
            <ext:FormPanel ID="EditFormPanel" runat="server" Title="收货单编辑" Region="North" Split="true"
                Height="200" Collapsible="true" Layout="BorderLayout" Padding="5" AnchorHorizontal="100%"
                LabelWidth="100">
                <TopBar>
                    <ext:Toolbar ID="TopBar" runat="server">
                        <Items>
                            <ext:DisplayField ID="DisplayField1" runat="server" StyleSpec="color:Red;" Text="注意：审核订单后方可起效！" />
                            <ext:ToolbarFill ID="ToolbarFill1" runat="server">
                            </ext:ToolbarFill>
                            <ext:Button ID="Button2" runat="server" Text="新增" Icon="Add">
                                <Listeners>
                                    <Click Fn="INV_ReceiveOrder.Mgr.resetEditData" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button1" runat="server" Text="保存" Icon="Disk">
                                <Listeners>
                                    <Click Fn="INV_ReceiveOrder.Mgr.saveReceiveMsg" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button4" runat="server" Text="删除" Icon="Delete">
                                <Listeners>
                                    <Click Fn="INV_ReceiveOrder.Mgr.deleteReceiveOrder" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button9" runat="server" Text="审核" Icon="Accept">
                                <Listeners>
                                    <Click Fn="INV_ReceiveOrder.Mgr.approveReceiveOrder" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="Button10" runat="server" Text="反审核" Icon="Cross">
                                <Listeners>
                                    <Click Fn="INV_ReceiveOrder.Mgr.unApproveReceiveOrder" />
                                </Listeners>
                            </ext:Button>
                        </Items>
                    </ext:Toolbar>
                </TopBar>
                <Items>
                    <ext:Panel ID="Panel1" runat="server" Header="false" Layout="HBoxLayout" LabelWidth="100"
                        Region="West" Width="560" Split="true" Border="false">
                        <Items>
                            <ext:Panel ID="Panel2" runat="server" Border="false" Header="false" Layout="FormLayout"
                                LabelAlign="Left" Padding="5">
                                <Items>
                                    <ext:TextField ID="FNumber" runat="server" FieldLabel="订单编号" Disabled="true" />
                                    <ext:TextField ID="FCreateTime" runat="server" FieldLabel="创建时间" Disabled="true" />
                                    <ext:TextField ID="FCreatorId" runat="server" FieldLabel="创建人" Disabled="true" />
                                    <ext:TextField ID="FModifyTime" runat="server" FieldLabel="修改时间" Disabled="true" />
                                    <ext:TextField ID="FModifierId" runat="server" FieldLabel="修改人" Disabled="true" />
                                </Items>
                            </ext:Panel>
                            <ext:Panel ID="Panel5" runat="server" Border="false" Layout="FormLayout" LabelAlign="Left"
                                Padding="5">
                                <Items>
                                    <ext:DateField ID="FBillDate" runat="server" FieldLabel="开单日期" AllowBlank="false"
                                        Width="137" Format="yyyy/MM/dd" />
                                    <ext:TextField ID="FApproveTime" runat="server" FieldLabel="审核时间" Disabled="true" />
                                    <ext:TextField ID="FApproverId" runat="server" FieldLabel="审核人" Disabled="true" />
                                    <ext:ComboBox ID="FStatus" FieldLabel="状态" runat="server" StoreID="OrderStatusStore"
                                        TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="FName"
                                        ValueField="FID" Width="137" SelectedIndex="0" Disabled="true" />
                                    <ext:TextField ID="FRemark" runat="server" FieldLabel="备注" />
                                </Items>
                            </ext:Panel>
                        </Items>
                    </ext:Panel>
                    <ext:Panel ID="Panel4" runat="server" Layout="FitLayout" Region="Center" Border="false">
                        <Items>
                            <ext:GridPanel ID="ReceiveOrderDetailGrid" runat="server" Border="false" TrackMouseOver="true"
                                ClicksToEdit="1" Region="Center" Header="false" StripeRows="true" AutoExpandColumn="FProductName"
                                StoreID="EditReceiveOrderDetailStore">
                                <TopBar>
                                    <ext:Toolbar ID="Toolbar2" runat="server">
                                        <Items>
                                            <ext:Button ID="Button7" runat="server" Text="添加产品" Icon="ApplicationAdd">
                                                <Listeners>
                                                    <Click Fn="INV_ReceiveOrder.Mgr.AddColumn" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:Button ID="Button8" runat="server" Text="删除产品" Icon="ApplicationDelete">
                                                <Listeners>
                                                    <Click Handler="#{ReceiveOrderDetailGrid}.deleteSelected();" />
                                                </Listeners>
                                            </ext:Button>
                                            <ext:ToolbarFill ID="ToolbarFill2" runat="server" />
                                            <ext:DisplayField ID="MsgDF" runat="server" StyleSpec="color:Red;" Text="" />
                                        </Items>
                                    </ext:Toolbar>
                                </TopBar>
                                <ColumnModel ID="ColumnModel2" runat="server">
                                    <Columns>
                                        <ext:Column ColumnID="FId" DataIndex="FId" Hidden="true">
                                        </ext:Column>
                                        <ext:Column ColumnID="FProductId" DataIndex="FProductId" Hidden="true">
                                        </ext:Column>
                                        <ext:Column ColumnID="FProductNumber" DataIndex="FProductNumber" Header="产品编号" Width="100">
                                            <Editor>
                                                <ext:TextField ID="TextField4" runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ColumnID="FProductName" DataIndex="FProductName" Header="产品名称" Editable="false">
                                            <Editor>
                                                <ext:TextField ID="TextField13" runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ColumnID="FNumber" DataIndex="FNumber" Header="数量" Width="50">
                                            <Editor>
                                                <ext:NumberField runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ColumnID="FPrice" DataIndex="FPrice" Header="单价" Width="60">
                                            <Editor>
                                                <ext:NumberField runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ColumnID="FAmount" DataIndex="FAmount" Header="金额" Width="60">
                                            <Editor>
                                                <ext:NumberField runat="server" />
                                            </Editor>
                                        </ext:Column>
                                        <ext:Column ColumnID="FRemark" DataIndex="FRemark" Header="备注">
                                            <Editor>
                                                <ext:TextField ID="TextField17" runat="server" />
                                            </Editor>
                                        </ext:Column>
                                    </Columns>
                                </ColumnModel>
                                <LoadMask ShowMask="true" />
                                <SelectionModel>
                                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" />
                                </SelectionModel>
                                <Listeners>
                                    <KeyDown Fn="INV_ReceiveOrder.Mgr.startEditing" />
                                    <AfterEdit Fn="INV_ReceiveOrder.Mgr.afterEdit" />
                                </Listeners>
                            </ext:GridPanel>
                        </Items>
                    </ext:Panel>
                </Items>
            </ext:FormPanel>
            <ext:FormPanel ID="SearchFormPanel" runat="server" Title="筛选条件" Region="West" Width="250"
                Split="true" Collapsible="true" Layout="FormLayout" Padding="5" LabelWidth="100">
                <Items>
                    <ext:TextField ID="FNumberTFS" runat="server" FieldLabel="订单编号" AnchorHorizontal="100%" />
                    <ext:DateField ID="FBillDateFrom" runat="server" FieldLabel="开单日期(从)" AnchorHorizontal="100%"
                        Format="yyyy/MM/dd" />
                    <ext:DateField ID="FBillDateTo" runat="server" FieldLabel="开单日期(到)" AnchorHorizontal="100%"
                        Format="yyyy/MM/dd" />
                    <ext:ComboBox ID="FStatusCBS" FieldLabel="状态" runat="server" StoreID="OrderStatusStore"
                        TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All" DisplayField="FName"
                        ValueField="FID" AnchorHorizontal="100%" EmptyText="请选择" />
                </Items>
                <Buttons>
                    <ext:Button ID="Button5" runat="server" Text="搜索" Icon="Accept">
                        <Listeners>
                            <Click Fn="INV_ReceiveOrder.Mgr.searchList" />
                        </Listeners>
                    </ext:Button>
                    <ext:Button ID="Button6" runat="server" Text="清空" Icon="Cancel">
                        <Listeners>
                            <Click Fn="INV_ReceiveOrder.Mgr.resetSearchData" />
                        </Listeners>
                    </ext:Button>
                </Buttons>
            </ext:FormPanel>
            <ext:Panel ID="Panel3" runat="server" Region="Center" Layout="AccordionLayout" Split="true"
                Header="false">
                <Items>
                    <ext:GridPanel ID="ReceiveOrderGrid" runat="server" Border="false" StoreID="ReceiveOrderListStore"
                        TrackMouseOver="true" ClicksToEdit="0" Region="Center" AutoExpandColumn="FNumberC">
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column ColumnID="FIdC" DataIndex="FId" Header="编号" Hidden="true">
                                </ext:Column>
                                <ext:Column ColumnID="FNumberC" DataIndex="FNumber" Header="订单编号">
                                </ext:Column>
                                <ext:Column ColumnID="FBillDateC" DataIndex="FBillDate" Header="开单日期">
                                </ext:Column>
                                <ext:Column ColumnID="FCreateTimeC" DataIndex="FCreateTime" Header="创建日期" Width="130">
                                </ext:Column>
                                <ext:Column ColumnID="FCreatorIdC" DataIndex="FCreatorId" Header="创建人">
                                </ext:Column>
                                <ext:Column ColumnID="FStatusC" DataIndex="FStatus" Header="状态" Sortable="false">
                                </ext:Column>
                                <ext:CommandColumn Width="60" Hideable="false">
                                    <Commands>
                                        <ext:GridCommand CommandName="Edit" Icon="ApplicationFormEdit" Text="修改">
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                                <ext:CommandColumn Width="60" Hideable="false">
                                    <Commands>
                                        <ext:GridCommand CommandName="Delete" Icon="Delete" Text="删除">
                                        </ext:GridCommand>
                                    </Commands>
                                </ext:CommandColumn>
                            </Columns>
                        </ColumnModel>
                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server">
                                <Items>
                                    <ext:Button ID="Button3" runat="server" Text="新增" Icon="Add">
                                        <Listeners>
                                            <Click Fn="INV_ReceiveOrder.Mgr.resetEditData" />
                                        </Listeners>
                                    </ext:Button>
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                        <BottomBar>
                            <ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="ReceiveOrderListStore"
                                PageSize="8" />
                        </BottomBar>
                        <Listeners>
                            <Command Fn="INV_ReceiveOrder.Mgr.commandHandler" />
                        </Listeners>
                        <LoadMask ShowMask="true" />
                        <SelectionModel>
                            <ext:RowSelectionModel>
                            </ext:RowSelectionModel>
                        </SelectionModel>
                    </ext:GridPanel>
                </Items>
            </ext:Panel>
        </Items>
    </ext:Viewport>
</body>
</html>
